package cn.sdack.go.common.entities.users;

import cn.sdack.go.common.entities.BaseEntity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import org.hibernate.validator.constraints.Length;

import java.util.List;

/**
 * @author sdack
 * @date 2024/2/17
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@MappedSuperclass
public class BaseDictEntity extends BaseEntity {

    // 英文标签
    @NonNull
    @NotNull(message = "code - 必填",groups = {Add.class, Set.class})
    @Length(min = 3,max = 150,message = "权限Code - 长度不正确",groups = {Add.class, Set.class})
    @Column(length = 150, nullable = false)
    private String code;

    // 中文描述
    @NonNull
    @NotNull(message = "名称 - 必填",groups = {Add.class, Set.class})
    @Length(min = 1,max = 50,message = "名称 - 长度不正确",groups = {Add.class, Set.class})
    @Column(length = 50,nullable = false)
    private String name;

    @Length(max = 50,message = "备注 - 长度不正确",groups = {Add.class, Set.class})
    @Column(length = 50)
    private String remark;

    @Column(nullable = false)
    private Boolean status = true;

    @Transient
    private List<DictItemEntity> itemList;
}
